package com.owc.domain.dto.admin;

import com.owc.common.converter.OutputConverter;
import com.owc.common.enums.StatusEnum;
import com.owc.domain.entity.RechargeFlow;
import com.owc.domain.entity.TransferRecord;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author Jackies
 * @Date 2019/12/16 21:56
 * @Description TODO://
 **/
@NoArgsConstructor
@Data
public class RechargeDetail {
    private DetailBean detail;
    private ChainBean chain;
    private List<FlowsBean> flowList;

    @NoArgsConstructor
    @Data
    public static class DetailBean implements OutputConverter<DetailBean, RechargeFlow> {

        private Long userId;
        private String phone;
        private String commitTime;
        private String tokenName;
        private BigDecimal rechargeAmount;
        private BigDecimal realAmount;
        private Integer status;

        @Override
        public void customConverter(DetailBean detailBean, RechargeFlow rechargeFlow) {
            detailBean.setCommitTime(rechargeFlow.getRechargeTime());
            detailBean.setRechargeAmount(rechargeFlow.getRealAmount());
            if(StatusEnum.SUCCESS.getType().equals(rechargeFlow.getStatus())){
                detailBean.setRealAmount(rechargeFlow.getRealAmount());
            }
        }
    }
}
